package common;

public class ThreadWorker implements Runnable {
	
	private Thread t = null;
	private String urlStr = null;
	private String fileName;
	
	public ThreadWorker(String urlStr) {
		if(t == null)
			t = new Thread(this);
		this.urlStr = urlStr;
	}
	
	public String fetchFileName() {
		if(t!=null) {
			t.start();
		}
		
		while(fileName==null) {
			try {
				Thread.sleep(100);
			}
			catch(InterruptedException ie){
				//
			}
		}
		
		return fileName;
	}

	public void run() {
		if(urlStr!=null) {
			fileName = "FID"+CommonUtil.getNumber(urlStr)+".something";
		}
	}

}
